{$layout "layout_popup"}

<h3>修改线路</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
    <csrf-token></csrf-token>
    <input type="hidden" name="routeId" :value="route.id"/>
    <table class="ui table definition selectable">
        <tr>
            <td class="title">线路名称 *</td>
            <td>
                <input type="text" name="name" maxlength="100" ref="focus" v-model="route.name"/>
            </td>
        </tr>
        <tr>
            <td rowspan="2">范围类型</td>
            <td>
                <select class="ui dropdown auto-width" v-model="rangeTypeCode" @change="changeRangeType">
                    <option v-for="rangeType in rangeTypes" :value="rangeType.code">{{rangeType.name}}</option>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <ns-route-ranges-box ref="routeRangesBox" :v-ranges="route.ranges"></ns-route-ranges-box>
            </td>
        </tr>
        <tr>
            <td>所属分类</td>
            <td>
                <div v-if="categories.length > 0">
                    <select class="ui dropdown auto-width" name="categoryId" v-model="route.categoryId">
                        <option value="0">[选择分类]</option>
                        <option v-for="category in categories" :value="category.id">{{category.name}}</option>
                    </select>
                    <p class="comment">可选项。</p>
                </div>
                <span class="comment" v-if="categories.length == 0">暂时还没有分类。</span>
            </td>
        </tr>
        <tr>
            <td>优先级</td>
            <td>
                <input type="text" name="priority" maxlength="10" style="width: 5em" v-model="route.priority"/>
                <p class="comment">优先级越高，越优先匹配。</p>
            </td>
        </tr>
        <tr>
            <td>公用</td>
            <td>
                <checkbox name="isPublic" v-model="route.isPublic"></checkbox>
                <p class="comment">选中后，表示允许用户使用当前创建的线路，否则只有管理员才能使用当前线路。</p>
            </td>
        </tr>
        <tr>
            <td colspan="2"><more-options-indicator></more-options-indicator></td>
        </tr>
        <tbody v-show="moreOptionsVisible">
            <tr>
                <td>启用当前线路</td>
                <td>
                    <checkbox name="isOn" value="1" v-model="route.isOn"></checkbox>
                </td>
            </tr>
        </tbody>
    </table>

    <submit-btn></submit-btn>
</form>